package com.zhang;

/**
 * @author ZhangJiXin
 * @Description 并查集测试类
 * @date 2021/4/30 10:11
 */
public class UnionFindTest {
    public static void main(String[] args) {
        UnionFind unionFind = new UnionFind_QU_S(12);
        unionFind.union(0,1);
        unionFind.union(0,2);
        unionFind.union(0,3);
        unionFind.union(0,4);
        unionFind.union(0,5);

        unionFind.union(6,7);

        unionFind.union(8,9);
        unionFind.union(8,10);
        unionFind.union(8,11);

//        unionFind.union(6, 5);
//        unionFind.union(10, 1);

        System.out.println(unionFind.isSame(0, 5));
        System.out.println(unionFind.isSame(0, 6));
        System.out.println(unionFind.isSame(8, 6));
        System.out.println(unionFind.isSame(8, 0));

    }
}
